package saeildamil.ch21.db;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import javax.swing.JOptionPane;



public class JDBCEx01 {
	public static void main(String[] args) {
		Connection con = null;
		try {
			Class.forName("com.mysql.jdbc.Driver");
			String url ="jdbc:mysql://localhost:3306/test";
			con = DriverManager.getConnection(url, "root", "rootroot");
			JOptionPane.showMessageDialog(null, "데이터베이스 연결성공");
		
		
		} catch (ClassNotFoundException e) {
			System.out.println("해당클래스 없음");
		} catch (SQLException e) {
			e.printStackTrace();
		}finally{
			try{con.close();}catch(Exception e){}
		}
	}
}
